Skip to content

Fix certificate count error handling in TLS accept - #629

Merged
michalvasko merged 1 commit into
develfrom
issue627-tls-cert-count
Aug 27, 2026
Merged

Fix certificate count error handling in TLS accept#629
michalvasko merged 1 commit into
develfrom
issue627-tls-cert-count

Conversation

@Roytak

@Roytak Roytak commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

nc_server_tls_get_num_certs() was declared to return uint32_t but returned -1 when a truststore reference could not be resolved. The error became UINT32_MAX and passed the "neither CA nor end-entity certificates configured" check, which could not fire anyway (an unsigned value compared with <= 0). With a referenced endpoint the two counts were added, so the wrapped value could even come out small.

Return the count through an output parameter and the error through the return value.

nc_server_tls_get_num_certs() was declared to return uint32_t but
returned -1 when resolving a truststore reference failed. The error
became UINT32_MAX, which then passed the "neither CA nor end-entity
certificates configured" check in nc_accept_tls_session() (a check
that could never fire anyway, comparing an unsigned value with <= 0).
With a referenced endpoint the two counts were added, so the wrapped
value could even come out as a small number.

Return the count through an output parameter and the error through
the return value instead.
@michalvasko
michalvasko merged commit 1578047 into devel Aug 27, 2026
11 checks passed
@michalvasko
michalvasko deleted the issue627-tls-cert-count branch August 27, 2026 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants